<script>
</script>
<div class='tabs'>
	<div class="uc_title m_10 tabs_menu">
		<label class="current node"><span>修改密码</span></label>
	</div>
</div>
<table class="form_table" width="100%" cellpadding="0" cellspacing="0" id="app">
	<col width="120px" />
	<col />
	<tr>
		<th>原密码：</th>
		<td><input id='repass' v-model="repass" class="normal" type="text" /><label></label></td>
	</tr>
	<tr>
		<th>新密码：</th>
		<td><input id='pwd' v-model="pwd" class="normal" type="text" /><label></label></td>
	</tr>
	<tr>
		<th>手机号：</th>
		<td><input id='phoneNumber' v-model="phoneNumber" class="normal" type="text" /><label></label></td>
	</tr>
	<tr>
		<th></th>
		<td><label class="btn"><input type="button" @click="updatepwd" id="updatepwd"
									  value="保存" /></label> <label class="btn">
			<input type="button" id="cancel" @click="cleanpwd" value="清空" /></label></td>
	</tr>
</table>
<script type="text/javascript">
	new Vue({
		el:"#app",
		data:{
			repass:"",
			pwd:"",
			phoneNumber:""
		},
		methods:{
			updatepwd:function () {
				console.log(this.repass);
				var params=new URLSearchParams();
				params.append("repass",this.repass);
				params.append("pwd",this.pwd);
				params.append("phoneNumber",this.phoneNumber);
				axios.post("/user/updatePwdByPhoneNumber",params)
						.then(res => {
							console.info(res);
							if (res.data.code ==200 ){
								layer.msg('恭喜你修改成功!', {icon: 1});
							}else if (res.data.code ==7){
								layer.msg('输入的手机号不是当前用户绑定手机号!', {icon: 5});
							}else if (res.data.code ==3){
								layer.msg('输入的旧密码不正确!', {icon: 5});
							}else if (res.data.code ==666){
								layer.msg('新密码与原密码相同!', {icon: 5});
							}else if (res.data.code ==305){
								layer.msg('输入的手机号格式错误!', {icon: 5});
							}else if (res.data.code ==307){
								layer.msg('密码格式错误，请输入6-12位数字密码!', {icon: 5});
							}
							else{
								layer.msg('系统异常!', {icon: 5});
							}
						});
			},
			cleanpwd:function(){
				this.phoneNumber = "";
				this.repass = "";
				this.pwd = "";
			}
		},
	});
</script>